using IcsSEMCtrl.Util;
using System;
namespace IcsSEMCtrl.Global.Device
{
	public class ElementType
	{
		public const int _EQUIPMENT = 0;
		public const int _MODULE = 1;
		public const int _SUBSYSTEM = 2;
		public const int _IODEVICE = 3;
		private int _value;
		private static int _size;
		private static ElementType[] _array;
		public static string[] displayStrings;
		public static ElementType[] displayValues;
		public static ElementType EQUIPMENT;
		public static ElementType MODULE;
		public static ElementType SUBSYSTEM;
		public static ElementType IODEVICE;
		public static ElementType IT_ENUM_MAX;
		static ElementType()
		{
			ElementType._size = 4;
			ElementType._array = new ElementType[ElementType._size];
			ElementType.displayStrings = new string[ElementType._size];
			ElementType.displayValues = new ElementType[ElementType._size];
			ElementType.EQUIPMENT = new ElementType(0);
			ElementType.MODULE = new ElementType(1);
			ElementType.SUBSYSTEM = new ElementType(2);
			ElementType.IODEVICE = new ElementType(3);
			ElementType.IT_ENUM_MAX = new ElementType(2147483647);
			ElementType.displayStrings[0] = "Equipment";
			ElementType.displayStrings[1] = "Module";
			ElementType.displayStrings[2] = "SubSystem";
			ElementType.displayStrings[3] = "IODevice";
			ElementType.displayValues[0] = ElementType.EQUIPMENT;
			ElementType.displayValues[1] = ElementType.MODULE;
			ElementType.displayValues[2] = ElementType.SUBSYSTEM;
			ElementType.displayValues[3] = ElementType.IODEVICE;
		}
		public static string ValueToString(ElementType val)
		{
			string result;
			switch (val.Value())
			{
			case 0:
				result = ElementType.displayStrings[0];
				break;
			case 1:
				result = ElementType.displayStrings[1];
				break;
			case 2:
				result = ElementType.displayStrings[2];
				break;
			case 3:
				result = ElementType.displayStrings[3];
				break;
			default:
				result = "";
				break;
			}
			return result;
		}
		public static ElementType StringToValue(string val)
		{
			ElementType result;
			if (Helper.IsNullOrEmpty(val))
			{
				result = ElementType.IT_ENUM_MAX;
			}
			else
			{
				for (int i = 0; i < ElementType.displayStrings.Length; i++)
				{
					if (val.Equals(ElementType.displayStrings[i]))
					{
						result = ElementType.displayValues[i];
						return result;
					}
				}
				result = null;
			}
			return result;
		}
		public int Value()
		{
			return this._value;
		}
		public static ElementType From_Int(int value)
		{
			ElementType result;
			if (value >= 0 && value < ElementType._size)
			{
				result = ElementType._array[value];
			}
			else
			{
				result = ElementType.IT_ENUM_MAX;
			}
			return result;
		}
		protected ElementType(int value)
		{
			this._value = value;
			if (value >= 0 && value < ElementType._size)
			{
				ElementType._array[this._value] = this;
			}
		}
		public bool Equals(ElementType otherEnum)
		{
			return otherEnum.Value() == this._value;
		}
		public override string ToString()
		{
			return ElementType.displayStrings[this._value];
		}
	}
}
